#include "C:\SAFIRE\Y\Y_BIFn\Y_BIFn.y.h"


VOID
Scenario_Gen_HTML_Header(NUMBER HTML_File,
                         STRING HTML_Title,
                         STRING ScenarioName,
                         STRING ScenarioDecription)
{
    WriteFile( HTML_File, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n");
    WriteFile( HTML_File, "<html>\n");
    WriteFile( HTML_File, "<head>\n");
    WriteFile( HTML_File, "<meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\">\n");
    WriteFile( HTML_File, "<title>");
    WriteFile( HTML_File, Title);
    WriteFile( HTML_File, "</title>\n");
    WriteFile( HTML_File, "<style type=\"text/css\">\n");
    WriteFile( HTML_File, "body         { font-family:arial,helvetica,sans-serif; background-color:#ffffff; }\n");
    WriteFile( HTML_File, "a            { text-decoration:none; }\n");
    WriteFile( HTML_File, ".title  { padding-top:2ex; padding-bottom:2ex; }\n");	
    WriteFile( HTML_File, "h1           { font-size:150%%; }\n");
    WriteFile( HTML_File, ".scenario    { margin:2ex; padding:0; width:800px; background-color:#808080; }\n");
    WriteFile( HTML_File, ".blue        { background-color:#688cf8; color:#ffffff; padding:0.5ex; }\n");
    WriteFile( HTML_File, ".beige       { background-color:#edf3bb; color:#000000; padding:0.5ex; }\n");
    WriteFile( HTML_File, ".red         { background-color:#CC6666; color:#000000; padding:0.5ex; }\n");
    WriteFile( HTML_File, ".green       { background-color:lightgreen; color:#000000; padding:0.5ex; }\n");
    WriteFile( HTML_File, "</style>\n");
    WriteFile( HTML_File, "</head>\n");
	
    WriteFile( HTML_File, "<body>\n");
    
    WriteFile( HTML_File, "<table class=\"scenario\">\n");
    WriteFile( HTML_File, "  <colgroup>\n");
    WriteFile( HTML_File, "    <col width=\"12%%\">\n");   
    WriteFile( HTML_File, "    <col width=\"13%%\">\n");
    WriteFile( HTML_File, "    <col width=\"25%%\">\n");
    WriteFile( HTML_File, "    <col width=\"50%%\">\n");
    WriteFile( HTML_File, "  </colgroup>\n");
    
    WriteFile( HTML_File, "  <tr>\n");
    WriteFile( HTML_File, "    <td colspan=\"2\" class=\"blue\">SCENARIO</td>\n");
    WriteFile( HTML_File, "    <td colspan=\"2\" class=\"beige\">");
    WriteFile( HTML_File, ScenarioName);
    WriteFile( HTML_File, "</td>\n");
    WriteFile( HTML_File, "  </tr>\n");
        
    WriteFile( HTML_File, "  <tr>\n");
    WriteFile( HTML_File, "    <td colspan=\"2\" class=\"blue\">DESCRIPTION</td>\n");
    WriteFile( HTML_File, "    <td colspan=\"2\" class=\"beige\">");
    WriteFile( HTML_File, ScenarioDecription);
    WriteFile( HTML_File, "</td>\n");
    WriteFile( HTML_File, "  </tr>\n");    
    
    WriteFile( HTML_File, "  <tr>\n");
    WriteFile( HTML_File, "    <td colspan=\"2\" class=\"blue\">VERDICT</td>\n");
    WriteFile( HTML_File, "    <td colspan=\"2\" class=\"blue\">REASON</td>\n");
    WriteFile( HTML_File, "  </tr>\n");   
}

VOID
Scenario_Gen_HTML_Verdict( NUMBER   HTML_File,
                           BOOLEAN  Final, 
                           STRING   ScenarioVerdict,
                           STRING   ScenarioReason)                           
{   
    STRING Prefix;

    IF (Final)  Prefix  = "FINAL"; 
    ELSE        Prefix  = "INTERIM";

    WriteFile( HTML_File, "  <tr>\n");	
        
		WriteFile( HTML_File, " <td class=\"blue\" >" + Prefix + "</td>\n");

    IF(ScenarioVerdict EQ "FAIL")
			WriteFile( HTML_File, " <td class=\"red\"   > " +  ScenarioVerdict + " </td>\n");
    ELSE
			WriteFile( HTML_File, " <td class=\"green\" > " +  ScenarioVerdict + " </td>\n");
        
		WriteFile( HTML_File, " <td colspan=\"2\" class=\"beige\" >" + ScenarioReason + "</td>\n");

    WriteFile( HTML_File, "</tr>\n");    
}

VOID
Scenario_Gen_HTML_Footer(NUMBER HTML_File)
{
    WriteFile( HTML_File, "</table>\n");    
    WriteFile( HTML_File, "</body>\n");
    WriteFile( HTML_File, "</html>\n");
}
